package com.shopping.controller;


import com.shopping.commons.PageParams;
import com.shopping.model.Book;
import com.shopping.model.view.CommentView;
import com.shopping.service.BookService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/book")
public class BookController {
    @Resource
    private BookService bookService;

    @GetMapping("/queryCommentById")
    public Map<String, Object> queryCommentById(Integer book_id, PageParams pageParams){
        return bookService.queryCommentById(book_id,pageParams);
    }
    @GetMapping("/queryBooks")
    public List<Book> queryBook(){
        return bookService.queryBook(0);
    }
    @GetMapping("/queryBookById")
    public Book queryBookById(Integer book_id){
        return bookService.queryBookById(book_id);
    }

}
